package pub.model;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Rolefunction entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "rolefunction", catalog = "sddf")
public class Rolefunction implements java.io.Serializable {

	// Fields

	private RolefunctionId id;
	private Role role;
	private Function function;

	// Constructors

	/** default constructor */
	public Rolefunction() {
	}

	/** full constructor */
	public Rolefunction(RolefunctionId id, Role role, Function function) {
		this.id = id;
		this.role = role;
		this.function = function;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({ @AttributeOverride(name = "roleId", column = @Column(name = "roleId", nullable = false)),
			@AttributeOverride(name = "functionId", column = @Column(name = "functionId", nullable = false)) })
	public RolefunctionId getId() {
		return this.id;
	}

	public void setId(RolefunctionId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "roleId", nullable = false, insertable = false, updatable = false)
	public Role getRole() {
		return this.role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "functionId", nullable = false, insertable = false, updatable = false)
	public Function getFunction() {
		return this.function;
	}

	public void setFunction(Function function) {
		this.function = function;
	}

}